package com.sevilla;


import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
public class DatosCancionero extends Activity{

	private  SQLiteDatabase db;
	private   UsuariosSQLiteHelper usdbh;
	
	public void onCreate(Bundle datos) {
		
		  super.onCreate(datos);
	        setContentView(R.layout.datoscancionero);
	       
	        Intent i=getIntent();
	        String s =i.getStringExtra("titulo");
	        
	        
	        TextView ltitulo = (TextView)findViewById(R.id.dtitulo);
	        TextView lentrada = (TextView)findViewById(R.id.dentrada);
	        TextView lperdon = (TextView)findViewById(R.id.dperdon);
	        
	        
	        TextView lgloria = (TextView)findViewById(R.id.dgloria);
	        TextView lantifona = (TextView)findViewById(R.id.dantifona);
	        TextView laleluya = (TextView)findViewById(R.id.daleluya);
	        TextView lofertorio = (TextView)findViewById(R.id.dofertorio);
	        TextView lsanto = (TextView)findViewById(R.id.dsanto);
	        TextView lpadre = (TextView)findViewById(R.id.dpadre);
	        TextView lpaz = (TextView)findViewById(R.id.dpaz);
	        TextView lcomunion = (TextView)findViewById(R.id.dcomunion);
	        TextView lsalida = (TextView)findViewById(R.id.dsalida);
	        
	        
	        usdbh =new UsuariosSQLiteHelper(this, "Cancionero", null, 1);
	       
	       db =usdbh.getReadableDatabase(); 
	        
	       
	      
	        Cursor r=   db.query("Cancionero", new String[]{"titulo","entrada","perdon","gloria","antifona","aleluya","ofertorio","santo","padre","paz","comunion","salida"} , null, null,null, null,null);
            r.moveToFirst();
            
         
       
            
            
           while(!s.equals(r.getString(0))){
        	   
        	   r.moveToNext();
        	   
        	   
           }
            
          ltitulo.setText(r.getString(0));
          lentrada.setText(r.getString(1));
          lperdon.setText(r.getString(2));  
          lgloria.setText(r.getString(3));
          lantifona.setText(r.getString(4));
          laleluya.setText(r.getString(5));
          lofertorio.setText(r.getString(6));
          lsanto.setText(r.getString(7));
          lpadre.setText(r.getString(8));
          lpaz.setText(r.getString(9));
          lcomunion.setText(r.getString(10));
          lsalida.setText(r.getString(11));
          
          
          
          //Prueba
          lentrada.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
					Intent i =  new Intent(DatosCancionero.this, sevilla28.class);
				
					startActivity(i);
			}
		});
	       
	}
	
	
	
}
